Skip to content

fix(wallet): Ensure transaction simulation throws an error for non-native clients on transaction simulation revert#2806

Merged
JCSanPedro merged 1 commit into
mainfrom
BSB-63-tx-flow-dead-code-removal
Mar 25, 2026
Merged

fix(wallet): Ensure transaction simulation throws an error for non-native clients on transaction simulation revert#2806
JCSanPedro merged 1 commit into
mainfrom
BSB-63-tx-flow-dead-code-removal

Conversation

@JCSanPedro

Copy link
Copy Markdown
Contributor

Hi👋, please ensure the PR title follows the below standards:

  • PR is titled with conventional commit style naming: type(scope): message. For example: feat(passport): my new feature
  • If you have introduced modification that necessitates immediate adjustments by this SDK's users to their applications, clients, or integrations to avert disruptions to existing features or functionalities, add a ! after the type(scope), for example feat(passport)!: my new breaking feature

Summary

Fall through to throwing an error when the guardian responds with a 422 for transaction evaluation for non-native clients.

Detail and impact of the change

The sdk checks the response code when simulating transactions.

      if (isAxiosError(error) && error.response?.status === 422) {
        if (this.crossSdkBridgeEnabled) {
          const revertReason = (error.response?.data as any)?.message ?? 'A transaction simulation reverted';
          throw new JsonRpcError(
            RpcErrorCode.TRANSACTION_REVERTED,
            `Transaction will revert: ${revertReason}`,
          );
        }

        return { confirmationRequired: true };
      }

When the response code is a 422 and crossSdkBridgeEnabled is true (native clients), the sdk will throw an error. However, there is a bug in this flow, where if crossSdkBridgeEnabled is false, the sdk would instead return an invalid { confirmationRequired: true } response.

This particular path is dead-code, as the guardian service only returns 422 for native clients. However, it is still preferable to remove it and improve the clarity of the flow.

Added

Changed

Deprecated

Removed

Fixed

Security

Anything else worth calling out?

@JCSanPedro JCSanPedro requested a review from a team as a code owner March 25, 2026 04:06
@nx-cloud

nx-cloud Bot commented Mar 25, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 5c1c4f7

Command Status Duration Result
nx affected -t build,lint,test ✅ Succeeded 3m 11s View ↗
nx run-many -p @imtbl/sdk,@imtbl/checkout-widge... ✅ Succeeded 1m 25s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-25 04:21:04 UTC

@JCSanPedro JCSanPedro added this pull request to the merge queue Mar 25, 2026
Merged via the queue into main with commit 8f551e5 Mar 25, 2026
8 checks passed
@JCSanPedro JCSanPedro deleted the BSB-63-tx-flow-dead-code-removal branch March 25, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants